package cn.smbms.service.impl;

import cn.smbms.dao.user.UserMapper;
import cn.smbms.pojo.User;
import cn.smbms.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: laoyu
 * @Date: 2019/8/27 12:07
 * @Description:
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> getUserList() {
        return userMapper.getUserList();
    }

    @Override
    public User queryUserByCondition(String userName, String pwd) {
        return userMapper.queryUserByCondition(userName, pwd);
    }

    @Override
    public User queryUserById(Integer id) {
        return userMapper.queryUserById(id);
    }

    @Override
    public boolean modifyUserById(User user) {
        return userMapper.modifyUserById(user) > 0 ? true : false;
    }

    @Override
    public List<User> queryUserByNameAndRole(String userName, String userRole) {
        return userMapper.queryUserByNameAndRole(userName, userRole);
    }

    @Override
    public boolean addNewUser(User user) {
        return userMapper.addNewUser(user) > 0 ? true : false;
    }

    @Override
    public boolean deleteById(Integer id) {
        return userMapper.deleteById(id) > 0 ? true : false;
    }
}
